package cn.arnold.offer.jinshanyun.test1;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int[] nums = new int[b - a + 1];
        //nums[b - a] = b;
        for (int i = 0; i < nums.length; i++) {
            nums[i] = a + i;
        }
        //15625 = 25 * 25 * 25
        int count = 0;
        for (int i = 0; i < nums.length; i++) {
            int m = nums[i];
            String strM = String.valueOf(m); //15625
            int n = strM.length(); //5
            double k = Math.cbrt(m);  //25.0
            if ((int) k - k == 0) {
                String strK = String.valueOf((int) k);//25
                int len = strK.length(); //2
                if (n >= len) {
                    String tail = strM.substring(n - len);
                    if (strK.equals(tail)) {
                        count++;
                    }
                }

            } else {
                continue;
            }

        }
        System.out.println(count);
    }
}
